package com.stary.code.springboot.config.data;

import com.stary.code.springboot.rules.DataSourcePoolType;
import com.stary.mybatisplus.generator.config.DbDriverName;

public class DataSourceConfig {
	/**
	 * url
	 */
	private String url;
	/**
	 * 类型,默认oracle
	 */
	private String type=DbDriverName.ORACLE.getDb();
	/**
	 * 驱动类名，根据类型自动匹配
	 */
	private String driverClassName=DbDriverName.ORACLE.getName();
	/**
	 * 登录用户
	 */
	private String username;
	/**
	 * 登录密码
	 */
	private String password;
	/**
	 * 连接池类型，默认 tomcat-jdbc
	 */
	private String poolType=DataSourcePoolType.TOMCAT_JDBC.getName();
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getDriverClassName() {
		if(DbDriverName.ORACLE.getDb().equals(type)){
			driverClassName=DbDriverName.ORACLE.getName();
		}
		if(DbDriverName.MYSQL.getDb().equals(type)){
			driverClassName=DbDriverName.MYSQL.getName();
		}
		if(DbDriverName.SQLSERVER.getDb().equals(type)){
			driverClassName=DbDriverName.SQLSERVER.getName();
		}
		return driverClassName;
	}
	public void setDriverClassName(String driverClassName) {
		this.driverClassName = driverClassName;
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getPoolType() {
		return poolType;
	}
	public void setPoolType(String poolType) {
		this.poolType = poolType;
	}
	

}
